package com.dream.controller;

import com.dream.model.Goods;
import com.dream.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;

@Controller
public class SearchConroller {
    @Autowired
    SearchService searchService;

    @RequestMapping(value = "/searchdemo")
    public ModelAndView nOSelectSearch() {
        ModelAndView modelAndView = new ModelAndView("search/searchlist");
        ArrayList<Goods> arrayList = (ArrayList<Goods>) searchService.serchResult();
        modelAndView.addObject("goods", arrayList);
        return modelAndView;
    }

}
